#include <stdio.h>
#include "threadpool.h"

void func(void* arg)
{
    int num = *(int*)arg;
    printf("thread %ld is working, number= %d\n",pthread_self(),num);
    sleep(1);
}

int main()
{
    threadPool* pool = createThreadPool(3,10,100);
    for (size_t i = 0; i < 100; i++)
    {
        int* num = (int*) malloc(sizeof(int));
        *num = i+100;
         addTaskTOPool(pool,func,num);
    }
    
    sleep(30);

    destoryThreadPool(pool);

    return 0;
}